Skip to content

Conversation

henrygr
Copy link
Member

@henrygr henrygr commented Oct 15, 2026 •

What this does

  • Working CI (ci.yaml): install → prettier check → ESLint → typecheck. The committed template ran npm ci / npm run test, which don't exist in this pnpm monorepo, so CI could never pass — and the deploy workflow is chained on its success. The Prisma client is generated in CI from a dummy env file (packages/db/src/generated is gitignored).
  • Deploy workflow (deploy-to-vm.yaml), runs automatically when CI succeeds on main:
    • Builds the frontend with VITE_GRAPHQL_URL baked in
    • Syncs the repo to /srv/gspotter on the VM, installs dependencies, and applies the Prisma schema (db:push)
    • Installs and restarts two systemd services: gspotter-backend (GraphQL on port 3001) and gspotter-frontend (SSR on port 3000)
    • Verifies both services with curl after restart
  • App config: backend listens on port 3001, frontend Vite base is /project2
  • ESLint: ignores build output directories (.output, dist, .nitro, .vinxi, .wrangler) so pnpm lint passes after a build

One-time VM setup (details in the deploy workflow header)

  • Node >= 22 + sudo npm i -g pnpm@10, installed system-wide so systemd can find them
  • Sudoers entry for the runner user: ALL=(root) NOPASSWD: /usr/bin/install, /usr/bin/tee, /usr/bin/systemctl
  • PostgreSQL via pnpm db:setup (see README)
  • Apache: ProxyPass /project2 http://localhost:3000/project2 (plus reverse), so the frontend is served at [baseurl]/project2 — it is an SSR Node server, not static files

@henrygr henrygr requested a review from a team as a code owner October 15, 2026 19:05
@henrygr henrygr self-assigned this Oct 15, 2026
@henrygr henrygr enabled auto-merge (squash) October 15, 2026 19:06
@henrygr henrygr disabled auto-merge October 15, 2026 19:08
* Add a CI workflow that installs dependencies, checks formatting, lints,
  and typechecks; the Prisma client is generated first from a dummy env
  file since packages/db/src/generated is not committed
* Replace the old template that ran `npm ci` and `npm run test`, which do
  not exist in this pnpm monorepo, so CI could never pass
* Add a deploy workflow that runs when CI succeeds on main: it builds the
  frontend with the VM GraphQL URL baked in, syncs the repo to
  /srv/gspotter, installs dependencies, applies the Prisma schema, and
  installs and restarts systemd services for the backend (port 3001) and
  the SSR frontend (port 3000), then verifies both with curl
* One-time VM prerequisites (node, pnpm, sudoers, Apache reverse proxy,
  PostgreSQL) are documented in the workflow file header
* Point the Apollo server at port 3001 so the API is reachable at
  [baseurl]:3001
* Set the Vite base path to /project2 so assets and routes resolve behind
  the Apache reverse proxy
* Add .output, dist, .nitro, .vinxi and .wrangler to the ESLint ignores
  so `pnpm lint` passes after a build
* Recent pnpm versions no longer read the "pnpm" field in package.json and
  fail the install with ERR_PNPM_IGNORED_BUILDS when a dependency's build
  scripts are unreviewed (strictDepBuilds)
* Approve both packages in allowBuilds in pnpm-workspace.yaml, the new home
  of the setting, and in the legacy onlyBuiltDependencies list for older
  pnpm versions; both postinstall scripts are benign (a version-scheme
  check and the standard napi-postinstall binary preparation)
* apps/frontend gained react-leaflet and @types/leaflet without a matching
  lockfile update, which makes every `pnpm install --frozen-lockfile` fail
* #11 landed while CI was broken, so Map.tsx, __root.tsx and about.tsx
  were merged without passing `prettier --check`
@henrygr henrygr enabled auto-merge (squash) October 15, 2026 19:26
@henrygr henrygr merged commit b58b3de into main Oct 15, 2026
1 check passed
@henrygr henrygr deleted the deploy-script branch October 15, 2026 19:31
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants